<template>
  <div>
    <button @click="login('admin')">管理员登录</button>
    <button @click="getUserInfo('Admin')">获取管理员菜单</button>
    <p></p>
    <button @click="login('user')">普通用户登录</button>
    <button @click="getUserInfo('Editor')">获取普通用户菜单</button>
  </div>
</template>

<script>
import { userActions } from '@/utils/actionName'

const { LOG_IN, MENUS } = userActions
export default {
  name: 'Login',
  methods: {
    login(user) {
      this.$store.dispatch(`user/${LOG_IN}`, user)
      this.$router.push('/mimi/list')
      // this.$axios({
      //   url: '/login',
      //   method: 'post',
      //   data: user
      // }).then(res => {
      //   console.log(res.data)
      // })
    },
    getUserInfo(user) {
      this.$store.dispatch(`user/${MENUS}`, user)
    },
  }
}
</script>

<style>

</style>